<template>
	<el-card style="height: 100%;">
		<div id="sss" >		
		<el-lable for="test1" >试卷：
	         <el-input v-model="form.name" style="width: 400px; " placeholder="请输入内容"></el-input>
		</el-lable>
		</br>
		<el-lable for="test2">科目：
		<el-select  placeholder="请选择课程" v-model="form.course_id" @change="clear"  >
		  <el-option v-for="course in courses" :key="course.id" :value="course.id" :label="course.name"></el-option>
		</el-select>
		</el-lable>
		</br>
		     <el-date-picker
		          v-model="form.create_time"
		          type="datetime"
		          placeholder="开始时间"
		          align="right"
		          :picker-options="pickerOptions"
				 value-format="yyyy-MM-dd HH:mm:ss"
				 >
		        </el-date-picker>
		<el-date-picker
		     v-model="form.update_time"
		     type="datetime"
		     placeholder="结束时间"
		     align="right"
		     :picker-options="pickerOptions"
			  value-format="yyyy-MM-dd HH:mm:ss"
			  >
		   </el-date-picker>
		
		<template >
			<div class="aaaaa">
		<el-button :plain="true"  @click="save()">保存</el-button>
		<el-button @click="out()">返回</el-button>
		</div>
		</template>
	</div>
	</el-card>
</template>

<script>
	 export default {
		 data() {
		 	return{
				form: {
				
				  name: '',
				  create_time: '',
				  update_time: '',
				  course_id:'',
				},
				 courses:[],
				/* history:[] */
			}
		 },
		 methods:{
			 save(){
				 this.$ajax.post('Shijuan/save',this.form).then(res=>{
				  console.log(res);
				   this.$message({
				            message: '恭喜你，这是一条成功消息',
				            type: 'success'
				          });
				thsi.$router.push({
					path:'/teacher/sjsz'
				})	 
				 })
			 },
			 out(){
				 this.$router.push('/teacher/sjsz')
			 },
			courseList(){
				  this.$ajax.post('course/courselist',{}).then(res=>{
				  var result=res.data.data;
				    this.courses=result;
					
				  })
				},

		 },
		 created() {
		 	this.courseList()
		 },
		
		 }
</script>

<style>
	.aaaaa{
		padding: 50px;
	}
</style>
